cmake_minimum_required(VERSION 3.20)
project(test_compress)

# 设置C++标准为C++20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 添加调试选项
set(CMAKE_BUILD_TYPE Debug)  # 设置构建类型为Debug
add_compile_options(-g)      # 添加-g选项以生成调试信息
add_compile_options(-O0)     # 添加-O0选项以禁用优化

enable_testing()

aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/../src SOURCE_FILES)
list(REMOVE_ITEM SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../src/FileBackup.cpp)  # 移除含有 main 文件
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../include)
add_executable(test_compress test_FileCompress.cpp ${SOURCE_FILES})

# 寻找gtest库
find_package(GTest REQUIRED)
# 包含gtest头文件目录
include_directories(${GTEST_INCLUDE_DIRS})
# 链接gtest库
target_link_libraries(test_compress ${GTEST_LIBRARIES} pthread)   

# 在编译时链接 stdc++fs
add_compile_options(-lstdc++fs)

add_test(NAME test_compress
         COMMAND test_compress)